package com.tjbklx1.beanutils.bak2;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;


/***
 * 标的状态
 * ClassName:EProductStatus.java
 * @author Sam Tan
 * @Description TODO
 * @date 2017年11月29日
 */
public enum EProductStatus {

	CHUANGJIAN("1", "创建"),
	TOUZIZHONG("2", "投资中"),
	LIUBIAO("3", "流标"),
	MANBIAO("4", "满标"),
	FANBENFUXI("5", "返本付息"),
	ZHONGZHI("6", "终止");

	private String key;
	private String value;
	
	private EProductStatus(String key, String value){
		this.key = key;
		this.value = value;
	}
	
	public static final Map<String, String> map = new HashMap<String, String>();
	static{
		for (EProductStatus item : EProductStatus.values()) {
			map.put(item.key, item.value);
		}
	}
	public static String getKey(String value){
		if(StringUtils.isNotEmpty(value)){
			for (Map.Entry<String,String> item : map.entrySet()) {
				if(value.equals(item.getValue())){
					return item.getKey();
				}
			}
		}
		return null;
	}
	
	public static String getValue(String key){
		if(StringUtils.isNotEmpty(key)){
			return map.get(key.trim());
		}
		return null;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
}
